package com.suep.system.service.impl;

import com.suep.system.domain.User;
import com.suep.system.mapper.UserMapper;
import com.suep.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl  implements IUserService {
    @Autowired
    private UserMapper userMapper;


    public Integer insertUser(User user) {
        return userMapper.insertUser(user);
    }
    public User selectUserById(Long id) {
        return userMapper.selectUserById(id);
    }
    public List<User> selectAllUsers() {
        return userMapper.selectAllUsers();
    }
    public Integer updateUser(User user) {
//        这里更新用户信息时，可能头像文件也要更新，所以需要在这里处理
        return userMapper.updateUser(user);
    }
    public Integer deleteUserById(Long id) {
        return userMapper.deleteUserById(id);
    }

    @Override
    public User selectUserByUsername(String username) {return userMapper.selectUserByUsername(username);
    }
}
